package com.twu.biblioteca;

import java.util.ArrayList;

public class Menu {
    ArrayList<MenuItem> menuItemArrayList;
    BibliotecaApp bibliotecaAppObject;

    public Menu(BibliotecaApp bibliotecaAppObject)
    {
        //Initialization of variables
        menuItemArrayList=new ArrayList<MenuItem>();
        this.bibliotecaAppObject=bibliotecaAppObject;

        addMenuItems();
    }

    public void addMenuItems()
    {
        menuItemArrayList.add(new BookDetailsMenuItem(bibliotecaAppObject));
        menuItemArrayList.add(new MovieDetailsMenuItem(bibliotecaAppObject));
        menuItemArrayList.add(new MembershipDetailsMenuItem(bibliotecaAppObject));
        menuItemArrayList.add(new BookOrderMenuItem(bibliotecaAppObject));
        menuItemArrayList.add(new LogOutMenuItem(bibliotecaAppObject));
        menuItemArrayList.add(new ExitMenuItem(bibliotecaAppObject));
    }

    public void displayMenuItems()
    {
        int loopCounter=0;
        //Displaying horizontal line for UI purpose
        System.out.println();
        for(loopCounter=0;loopCounter<50;loopCounter++)
            System.out.print("_");
        //Displaying menu items
        for(loopCounter=0;loopCounter<menuItemArrayList.size();loopCounter++)
        {
            MenuItem menuItemObject=menuItemArrayList.get(loopCounter);
            System.out.println("\n\t"+(loopCounter+1)+"  "+ menuItemObject.optionString);
        }
        //Displaying horizontal line for UI purpose
        System.out.println();
        for(loopCounter=0;loopCounter<50;loopCounter++)
            System.out.print("_");
    }
}
